<?php

namespace common\models\credit_app_tables;

use Yii;

/**
 * This is the model class for table "{{%req_log}}".
 *
 * @property int $id
 * @property string $host_head
 * @property int $type
 * @property string $route
 * @property int $created_at
 * @property string $from_ip
 * @property string $other_data
 * @property string $get
 * @property string $post
 * @property string $exception
 * @property string $files
 */
class ReqLog extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%req_log}}';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('db_app');
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['host_head', 'type', 'route', 'created_at'], 'required'],
            [['type', 'created_at'], 'integer'],
            [['other_data', 'get', 'post', 'exception', 'files'], 'string'],
            [['host_head'], 'string', 'max' => 3],
            [['route'], 'string', 'max' => 255],
            [['from_ip'], 'string', 'max' => 100],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'host_head' => Yii::t('app', 'Host Head'),
            'type' => Yii::t('app', 'Type'),
            'route' => Yii::t('app', 'Route'),
            'created_at' => Yii::t('app', 'Created At'),
            'from_ip' => Yii::t('app', 'From Ip'),
            'other_data' => Yii::t('app', 'Other Data'),
            'get' => Yii::t('app', 'Get'),
            'post' => Yii::t('app', 'Post'),
            'exception' => Yii::t('app', 'Exception'),
            'files' => Yii::t('app', 'Files'),
        ];
    }
}
